﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CoolCode;
using CoolCode.Data;
using CoolCode.Services;
using TopTen.Entities;

namespace TopTen.Services.Implement
{
	public class WidgetService : ServiceBase, IWidgetService
	{
		#region Data Access Objects

		private IRepository<Widget> _WidgetDao;
		public IRepository<Widget> WidgetDao
		{
			get
			{
				if (_WidgetDao == null)
				{
					_WidgetDao = this.CreateRepository<Widget>();
				}
				return _WidgetDao;
			}
			set
			{
				_WidgetDao = value;
			}
		}

		#endregion

		public void Save(Widget entity)
		{
			this.WidgetDao.Save(entity);
		}

		public void Delete(int id)
		{
			this.WidgetDao.Delete(id);
		}

		public Widget Get(int id)
		{
			return this.WidgetDao.Get(id);
		}

		public List<Widget> List()
		{
			return this.WidgetDao.List();
		}
	}
}
